package com.ufcg.lvc.client.MyListGrids;

import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.ufcg.lvc.client.GreetingServiceCRUDAsync;

/**
 * 
 * @author Larissa Costa
 *
 */
public abstract class MyListGrid extends ListGrid {
	
	String[] campos = new String[5];
	String[] titulos = new String[5];
	GreetingServiceCRUDAsync servico;
	
	public MyListGrid() {
		super();
		this.setSize("780px", "267px");

		this.setShowRecordComponents(true);
		this.setShowRecordComponentsByCell(true);

		this.setWidth(780);
		this.setHeight(267);
		this.setShowAllRecords(true);

		this.setCanEdit(false);
		this.setCanResizeFields(true);	
	}

	public void addColunas(String[] campo, String[] titulo) {
		ListGridField[] myListGridFields = new ListGridField[campo.length];
		for (int i = 0; i < campo.length; i++) {
			myListGridFields[i] = new ListGridField(campo[i], titulo[i]);
		}
		this.setFields(myListGridFields);
	}

	public String[] getTitulos() {
		return titulos;
	}

	public void setTitulos(String[] titulos) {
		this.titulos = titulos;
	}

	public String[] getCampos() {
		return campos;
	}

	public void setCampos(String[] campos) {
		this.campos = campos;
	}
	
	public GreetingServiceCRUDAsync getServico() {
		return servico;
	}

	public void setServico(GreetingServiceCRUDAsync servico) {
		this.servico = servico;
	}
}
